//
//  ThreeDownTableViewCell.m
//  Food
//
//  Created by 15 on 15/7/20.
//  Copyright (c) 2015年 李志远. All rights reserved.
//

#import "ThreeDownTableViewCell.h"
#import "BaseHeader.h"
#import "UIImageView+WebCache.h"
@implementation ThreeDownTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.viewFood = [[[UIImageView alloc] init] autorelease];
        [self.contentView addSubview:self.viewFood];
        self.lblInstruction = [[[UILabel alloc] init] autorelease];
        [self.contentView addSubview:self.lblInstruction];
        self.lblBrowse = [[[UILabel alloc] init] autorelease];
        [self.contentView addSubview:self.lblBrowse];
        self.lblTitle = [[[UILabel alloc] init] autorelease];
        [self.contentView addSubview:self.lblTitle];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.viewFood.frame = CGRectMake(10, 10, 80, 60);
    self.lblTitle.frame = CGRectMake(95, 11, 200, 20);
    self.lblInstruction.frame = CGRectMake(self.lblTitle.frame.origin.x, 31, 200, 20);
    self.lblInstruction.numberOfLines = 2;
    [self.lblInstruction sizeToFit];
    self.lblBrowse.frame = CGRectMake(self.lblInstruction.frame.origin.y + self.lblInstruction.frame.size.width, 53, 90, 20);
}

- (void)setModel:(HealthKonw *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    [self.viewFood setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    self.lblTitle.text = model.title;
    self.lblTitle.font = [UIFont systemFontOfSize:14];
    self.lblInstruction.text = model.content;
    self.lblInstruction.font = [UIFont systemFontOfSize:10];
    self.lblBrowse.text = [NSString stringWithFormat:@"%@浏览", model.allClick];
    self.lblBrowse.font = [UIFont systemFontOfSize:10];
    self.lblBrowse.textColor = FONTCOLOR;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
